<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<?php include("conn.php"); ?>
<HTML 
xmlns="http://www.w3.org/1999/xhtml">


<?
if(isset($_REQUEST['make']))
 {
  $make=$_REQUEST['make'];
  $sqlCar="select * from car where make='$make' and sold_date='00000000'";
  $qryCar=mysql_query($sqlCar,$conn);
  
 }
else{$make="none";}

$sqlMake="select make from make order by make";
$qryMake=mysql_query($sqlMake,$conn);

?>
<HEAD>
<script language="javascript" type="text/javascript">

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}

</script>
<TITLE>Untitled Document</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>BODY {
	COLOR: #ffff00
}
TD {
	COLOR: #ffff00
}
TH {
	COLOR: #ffff00
}
BODY {
	BACKGROUND-COLOR: #3366ff
}
</STYLE>

<META content="MSHTML 6.00.2900.2523" name=GENERATOR></HEAD>
<BODY link="#FFCC00">
<table border="0" width="100%" id="table1">
	<tr>
		<td height="52">
		<form method="POST" action="carListing.php">
			
			<p>&nbsp;<select size="1" name="make">
			<? while($rowMake=mysql_fetch_assoc($qryMake)){
					if (strcmp ($make, $rowMake['make']) == 0)
					{ ?>
					<option selected><?=$rowMake['make']?></option>
					<?}
					else { ?>
					  <option><?=$rowMake['make']?></option>
					<?}}?>
					</select>
			</select>&nbsp; <font face="Verdana"> 
			<input type="submit" value="View" name="B1" style="font-family: Verdana; font-size: 10px"></font> </p>
		</form>
		</td>
	</tr>
	<tr>
		<td>
		<table border="0" width="98%" id="table2">
			<?if($make!="none") {?>
			<tr>
				
          <td bgcolor="#333333" valign="top"><b><font size="2" face="Verdana">Jenama</font></b></td>
				<td width="161" bgcolor="#333333" valign="top"><b>
				<font size="2" face="Verdana">Model</font></b></td>
				
          <td width="35" bgcolor="#333333" valign="top"><b> <font size="2" face="Verdana">Tahun</font></b></td>
				
          <td width="64" bgcolor="#333333" valign="top"><b> <font size="2" face="Verdana">Harga</font></b></td>
				
          <td bgcolor="#333333" valign="top"><b><font size="2" face="Verdana"> 
            Huraian </font></b></td>
          <td bgcolor="#333333" valign="top" width="149"><b><font size="2" face="Verdana">Gambar</font></b></td>
			</tr>
			<? while($rowCar=mysql_fetch_assoc($qryCar)){?>
			<tr>
				<td valign="top"><font face="Verdana" size="2" color="#FFFFFF">&nbsp;<?=$rowCar['make']?></font></td>
				<td width="161" valign="top">
				<font face="Verdana" size="2" color="#FFFFFF">&nbsp;<?=$rowCar['model']?></font></td>
				<td width="35" valign="top">
				<font size="2" face="Verdana" color="#FFFFFF"><?=$rowCar['year']?></font></td>
				<td width="64" valign="top">
				<font size="2" face="Verdana" color="#FFFFFF"><?=$rowCar['price']?></font></td>
				<td valign="top"><font face="Verdana" size="2" color="#FFFFFF">&nbsp;<?=$rowCar['remark']?></font></td>
				<td valign="top" width="149">
				<font face="Verdana" size="2" color="#FFFFFF">&nbsp;<a href="carDetail.php?d=<?=$rowCar['id']?>" onclick="NewWindow(this.href,'mywin','800','600','yes','center');return false" onfocus="this.blur()"><img src="carpic/<?=$rowCar['pic']?>" alt="<?=$rowCar['model']?>" border="1" hspace="7" vspace="2" width="67" height="67"></a></font></td>
			</tr>
			<?}
			if(mysql_num_rows($qryCar)==0) {?>
			<tr>
				
          <td colspan="6"> <p align="center"><b><font size="3" face="Verdana" color="#00FFFF">&nbsp;</font></b><font size="3" face="Gill Sans MT" color="#00FFFF"><strong><font color="#66FF00" size="4">Rekod 
              kereta 
              <?=$make?>
              tidak dapat dikesan !</font></strong></font><font size="4" face="Verdana" color="#00FFFF"><b> 
              </b></font></td>
			</tr>
			<?}?>
			
		</table>
		
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
<? } else
	  {
        $sqlMake="select make from make order by make";
        $qryMake=mysql_query($sqlMake,$conn);
	  
	  ?>
<table border="0" width="79%" id="table3">
	<tr>
		
    <td>&nbsp;<b><font size="4" face="Verdana">Sila pilih salah satu jenama untuk 
      dipaparkan.</font></b></td>
	</tr>
	<? while($rowMake1=mysql_fetch_assoc($qryMake)){ ?>
	<tr>
		<td><font size="2" face="Verdana" color="#333333">&nbsp;<a href="carListing.php?make=<?=$rowMake1['make']?>"><?=$rowMake1['make']?></a></font></td>
	</tr>
	<?}?>
</table>
<?}?>

</BODY></HTML>